

#购物系统需求1.0：
# money=100
# goods_list=["薯片","可乐","矿泉水"]
# while True:
#
# # price_list=[]
# # stock_list=[]
#     print("输入您想要的商品：")
#
#     print("您也可以输入Q/q退出,")
#     target_goods = input()
#     cart_list=[]
# # l=goods_list.index(target_goods)
# # print(l)
#
#     if target_goods in goods_list:
#         print("有")
#
#     # cart_list.append(target_goods)
#     # print(cart_list)
#     # print("已将%s，加入购物车"%target_goods)
#         if target_goods == "薯片"and money>5:
#             money-=5
#             cart_list.append(target_goods)
#             print("已将%s，加入购物车" % target_goods)
#             print("恭喜，购买成功！您的卡余额为：%s"% money)
#         elif target_goods == "可乐"and money>3:
#             money-=3
#             cart_list.append(target_goods)
#             print("已将%s，加入购物车" % target_goods)
#             print("恭喜，购买成功！您的卡余额为：%s" % money)
#         elif target_goods == "矿泉水"and money>1:
#             money-=1
#             cart_list.append(target_goods)
#             print("已将%s，加入购物车" % target_goods)
#             print("恭喜，购买成功！您的卡余额为：%s" % money)
#         else:
#             print("您卡余额不足，请到其他超市购买！")
#
#     elif target_goods=="q" or target_goods=="Q":
#         break
#     else:
#         print("抱歉，暂时没有该商品")

    # print("您可以输入Q/q退出,")
    # quit=input()
    # if quit==Q or quit==q:
    #     break
    # print("购物小条：%s"%cart_list)


# 购物系统需求2.0：
import random
from datetime import datetime
shopping_time=datetime.now()
money=100
goods_list=["薯片","可乐","矿泉水","利群"]
price_list=[5,3,1,18]
stock_list=["5包","5瓶","5瓶","5包"]
goods_info=dict(zip(goods_list,stock_list))
print(goods_info)
discount_list=[5,6,7,8,9]
print("开业大酬宾，进店就可以抽取优惠券，五折起")
your_discount=random.choice(discount_list)
dicount_n=1
print("恭喜您，您抽取的优惠券是：%d折"%your_discount)
count=0
shopping_value=0
goods_back="no"
while True:

    print("输入您想要的商品：")
    print("您也可以输入Q/q退出,")
    target_goods = input()
    cart_list=[]
    if target_goods in goods_list:
        print("有")
        count+=1
        if target_goods == "薯片"and money>5  :
            if dicount_n>0:
                money-=5*0.1*your_discount
                shopping_value=5*0.1*your_discount
            else:
                money-=5
                shopping_value=5
            cart_list.append(target_goods)
            print("已将%s，加入购物车" % target_goods)
            print("恭喜，购买成功！您的卡余额为：%s"% money)
            n=5
            n-=1
            goods_info["薯片"]=n
            print("如果您想要退货请输入yes,不用退货输入no")
            goods_back=input()
            if goods_back=="yes":
                money+=shopping_value
                print("退货成功，金额将原路返回！您的余额为：%s"%money)
                n+=1
        elif target_goods == "可乐"and money>3:
            if dicount_n>0:
                money-=3*0.1*your_discount
                shopping_value=3*0.1*your_discount
            else:
                money-=3
                shopping_value = 3
            cart_list.append(target_goods)
            print("已将%s，加入购物车" % target_goods)
            print("恭喜，购买成功！您的卡余额为：%s" % money)
            n = 5
            n -= 1
            goods_info["薯片"] = n
            print("如果您想要退货请输入yes,不用退货输入no")
            goods_back = input()
            if goods_back == "yes":
                money += shopping_value
                print("退货成功，金额将原路返回！您的余额为：%s" % money)
                n += 1
        elif target_goods == "矿泉水"and money>1:
            if dicount_n > 0:
                money -= 1 * 0.1 * your_discount
                shopping_value=1 * 0.1 * your_discount
            else:
                money -= 1
                shopping_value=1

            cart_list.append(target_goods)
            print("已将%s，加入购物车" % target_goods)
            print("恭喜，购买成功！您的卡余额为：%s" % money)
            n = 5
            n -= 1
            goods_info["薯片"] = n
            print("如果您想要退货请输入yes,不用退货输入no")
            goods_back = input()
            if goods_back == "yes":
                money += shopping_value
                print("退货成功，金额将原路返回！您的余额为：%s" % money)
                n += 1
        elif target_goods =="利群" and money>18:
            if dicount_n > 0:
                money -= 18 * 0.1 * your_discount
                shopping_value=18 * 0.1 * your_discount
            else:
                money -= 18
                shopping_value=18

            cart_list.append(target_goods)
            print("已将%s，加入购物车" % target_goods)
            print("恭喜，购买成功！您的卡余额为：%s" % money)
            n = 5
            n -= 1
            goods_info["薯片"] = n
            print("如果您想要退货请输入yes,不用退货输入no")
            goods_back = input()
            if goods_back == "yes":
                money += shopping_value
                print("退货成功，金额将原路返回！您的余额为：%s" % money)
                n += 1
        else:
            print("您卡余额不足，请到其他超市购买！")
    elif target_goods=="q" or target_goods=="Q":
        break
    else:
        print("抱歉，暂时没有该商品")
    # 退货:
    # print("如果您想要退货请输入yes,不用退货输入no")

print("购物小条：%s,购物时间：%s,卡余额：%s，购物数量：%s，购买商品价值：%s" % (cart_list,shopping_time,money,count,shopping_value))